﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.Model;
using Register.IDAL;
using Register.DALFactory;
using Register.Command;

namespace Register.BLL
{
    /// <summary>
    /// FileName: MenuListService.cs
    /// CLRVersion: 4.0.30319.269
    /// Author: WangYan
    /// Corporation: 此类是临时的类，后边加了权限以后会重新封装
    /// Description: 
    /// DateTime: 2012/6/24 19:55:17
    /// </summary>
    public class MenuListService
    {
        private static String typeNameKey1 = "ModuleInfoDALKey";
        private static String typeNameKey2 = "ModuleTopInfoDALKey";
        private List<ModuleTopInfo> moduleTopInfoList;

        public List<ModuleTopInfo> ModuleTopInfoList
        {
            get { return moduleTopInfoList; }
        }

        public MenuListService()
        {
            try
            {
                IModuleTopInfoDAL iModuleTopInfoDAL = DALFactory<IModuleTopInfoDAL>.Create(typeNameKey2);
                IModuleInfoDAL iModuleInfoDAL = DALFactory<IModuleInfoDAL>.Create(typeNameKey1);

                moduleTopInfoList = iModuleTopInfoDAL.GetModuleTopInfos();

                foreach (ModuleTopInfo mti in moduleTopInfoList)
                {
                    mti.ModuleInfoList = iModuleInfoDAL.GetModuleInfoByTopID(mti.ModuleTop_ID);
                }
            }
            catch (Exception e)
            {
                LogRecordHelper.LogNote("ERROR", e.Message);
                throw e;
            }

        }
    }
}
